package com.hz.user.interfaces.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hz.base.beans.vo.CommonResult;
import com.hz.base.beans.vo.PageEntity;
import com.hz.base.beans.vo.QueryParams;
import com.hz.beans.code.HzOperateCode;
import com.hz.beans.user.entity.BaseRole;
import com.hz.common.beans.constant.DemoResult;
import com.hz.interfaces.user.inf.IBaseRoleInterface;
import com.hz.user.service.inf.IBaseRoleService;

@Service("baseRoleInterface")
public class BaseRoleInterface implements IBaseRoleInterface{
	
	@Autowired
	private IBaseRoleService baseRoleService;
	

	@Override
	public CommonResult<BaseRole> queryRole(Long id) {
		CommonResult<BaseRole> cr = new DemoResult<>();
		cr = baseRoleService.selectByPrimaryKey(cr,id);
		cr.setOperate(HzOperateCode.QUERY_BASEROLE);
		return cr;
	}

	@Override
	public CommonResult<BaseRole> addRole(BaseRole baseRole, Long[] menuIds) {
		CommonResult<BaseRole> cr = new DemoResult<>();
		cr = baseRoleService.insert(cr, baseRole);
		cr.setOperate(HzOperateCode.ADD_BASEROLE);
		return cr;
	}
	
	@Override
	public CommonResult<PageEntity> queryForPage(QueryParams<BaseRole> queryParams) {
		CommonResult<PageEntity> cr = new DemoResult<>();
		cr = baseRoleService.queryForPage(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_BASEROLE_PAGE);
		return cr;
	}

	@Override
	public CommonResult<List<BaseRole>> queryRoleList(QueryParams<BaseRole> queryParams) {
		CommonResult<List<BaseRole>> cr = new DemoResult<>();
		cr = baseRoleService.queryForList(cr, queryParams);
		cr.setOperate(HzOperateCode.QUERY_BASEROLE_LIST);
		return cr;
	}

	@Override
	public CommonResult<BaseRole> updateRole(BaseRole baseRole) {
		CommonResult<BaseRole> cr = new DemoResult<>();
		cr = baseRoleService.updateByPrimaryKey(cr, baseRole);
		cr.setOperate(HzOperateCode.UPDATE_BASEROLE);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteRoleArray(Long[] ids) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = baseRoleService.deleteObjectArray(cr, ids);
		cr.setOperate(HzOperateCode.DELETE_BASEROLE);
		return cr;
	}

	@Override
	public CommonResult<BaseRole> insertSelective(BaseRole baseRole) {
		CommonResult<BaseRole> cr = new DemoResult<>();
		cr = baseRoleService.insertSelective(cr, baseRole);
		cr.setOperate(HzOperateCode.INSERTSELECTIVE_BASEROLE);
		return cr;
	}

	@Override
	public CommonResult<Object> deleteByList(List<BaseRole> baseRoleList) {
		CommonResult<Object> cr = new DemoResult<>();
		cr = baseRoleService.deleteByList(cr, baseRoleList);
		cr.setOperate(HzOperateCode.DELETELIST_BASEROLE);
		return cr;
	}

	@Override
	public CommonResult<List<BaseRole>> batchUpdate(List<BaseRole> baseRoleList) {
		CommonResult<List<BaseRole>> cr = new DemoResult<>();
		cr = baseRoleService.batchUpdate(cr, baseRoleList);
		cr.setOperate(HzOperateCode.BATCHUPDATE_BASEROLE);
		return cr;
	}

	@Override
	public CommonResult<List<BaseRole>> batchSave(List<BaseRole> baseRoleList) {
		CommonResult<List<BaseRole>> cr = new DemoResult<>();
		cr = baseRoleService.batchSave(cr, baseRoleList);
		cr.setOperate(HzOperateCode.BATCHSAVE_BASEROLE);
		return cr;
	}

}
